<%@ page language="java" import="java.util.*,com.hs.wdss.model.*,com.hs.core.utils.*,com.hs.core.cache.*" pageEncoding="utf-8"%>
<%
	String maganame = (String)request.getAttribute("maganame");
	String title = (String)request.getAttribute("title");
	
	PageUtil pageUtil = (PageUtil)request.getAttribute("dataList");
    String pageStr = ""; 
    int perpageCount = 1;
    int currentPage = 1;
    List dataList = null;
    if(null != pageUtil){
	   dataList = pageUtil.getPageList();
	   pageStr = pageUtil.getPageStr();
	   perpageCount = pageUtil.getNumberPerPage();
	   currentPage = pageUtil.getCurrentPage();
	} 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<%@ include file="../../include.jsp"%> 
<script src='<%=basePath%>dwr/interface/datamanagerdwr.js'></script> 
<script language=JavaScript>
 //查询
 function searchData()
{
  	document.searchform.action="<%=basePath%>data/datamagaList.do";	
	document.searchform.submit();
}
//删除题录信息
 function deleteMaga(id){
 	if(confirm("确定要删除该书籍信息吗?")){
 		datamanagerdwr.deleteBook(id,callback4delete); 
 	}
 }

 function callback4delete(message){
    if("0" == message)
 	    alert("该书籍信息已经被医案信息引用，不能够删除");  
 	else{
 	   alert("成功删除古籍信息!");
 	   document.searchform.submit();
 	} 
 }

 function exportData()
{
	document.searchform.action="<%=basePath%>data/exportData.do";	
  	document.searchform.submit();
}
//题录信息
 function magaInfo(id)
{
	var pageURL = "<%=basePath %>data/magainfo.do?id=" + id;
	openwindow(pageURL,'800','600','期刊文献信息'); 
}
</script>
</head>
<body>
<div class="cont">
    <dl class="deta_list">
         	<form name="searchform" action="<%=basePath %>data/datamagaList.do?1=1" method=post>
			   <table width="100%" border="0" cellspacing="0" cellpadding="0" class="sear">
			      <tr>
			        <td width="15%">
			           刊名：
			          </td>
			          <td width="20%"> 
			           <input name="maganame" type="text" value="<%=maganame == null?"":maganame%>" />
			           </td> 
			           <td width="15%">
			           题名：
			          </td>
			          <td width="20%">
			           <input name="title" type="text" value="<%=title == null?"":title%>" />
			           </td>
			           <td width="15%">
			            <input name="search" type="button" value="查询"  onclick="searchData();" class="butt"/>
			            </td>
			           <td width="15%">
			            <input name="export" type="button" value="导出全部"  onclick="exportData();" class="butt"/> 
			        </td>
			        </tr>
			    </table>
			    </form> 
                <table border="0" cellspacing="0" cellpadding="0" style="width:100%" class="list">
                  <tr>
                    <th width="10%">序号</th>
                    <th width="20%">刊名</th>
                    <th width="30%">题名</th>
                    <th width="20%">作者</th>  
                    <th width="10%">出版日期</th>
                    <th width="10%">操作</th>
                  </tr>
                   <%if(dataList != null && dataList.size()>0){ 
			   			 for(int i =0;i<dataList.size();i++){
			     		    WdssResource obj = (WdssResource)dataList.get(i); 
 					%>
                  <tr>
                    <td align="center"><%= perpageCount*(currentPage-1)+i+1 %></td>
                    
                    <td><%= obj.getMaganame()==null?"":obj.getMaganame() %></td>
                    <td><a href="javaScript:magaInfo('<%=obj.getId() %>')"><%= obj.getTitle()==null?"":obj.getTitle() %></a></td>
                     <td><%= obj.getAuthor()==null?"":obj.getAuthor() %></td>
                    <td> <%= obj.getPublishdate()==null?"":obj.getPublishdate()%> </td>
                    <td align=center><input onclick="deleteMaga('<%=obj.getId() %>');" type="button" value="删除" class="butt"/></td>
                  </tr>
                 
                  
         		 <%}}else{ %>
			 	<tr>
					<td colspan="6" align=center> 
			      <font color=red>没有符合条件的结果</font></td>
			     </tr>
		  		 <%} %>
		  		 
		  		 <tr>
					<td colspan="7" align=right> 
			     <%=pageStr %></td>
			     </tr>
                </table>
        	
        	 
    </dl>
</div>
</body>
</html>